package com.luo.shop.config;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class portalLoginInterceptor implements HandlerInterceptor {

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object portalUser = request.getSession().getAttribute("portalUser");
        if (portalUser==null){
            response.sendRedirect("/login");
            return false;
        }
        return true;
    }
}
